MODNAME= mysql
all:$(MODNAME).o
	gcc -shared objs/*.o -o $(MODNAME).so -L/usr/lib64/mysql/ -lmysqlclient -llua

$(MODNAME).o:
	[ -d objs ] || mkdir objs;
	cd objs && gcc -O3 -fPIC -c ../*.c;
	#`cd ../` && gcc -g -shared objs/*.o -o $(MODNAME).so 

install:
	#cd objs && gcc -O3 -fPIC -c ../*.c;
	#`cd ../` && gcc -shared -O3 objs/*.o -o $(MODNAME).so  -L/usr/lib64/mysql/ -lmysqlclient -llua
	cp $(MODNAME).so $< /usr/local/lib/lua/5.1/

clean:
	rm -r objs;
	rm $(MODNAME).so;
#gcc -O3 -fPIC -c *.c
#gcc -shared -O3 *.o -o mysql.so -L/usr/lib64/mysql/ -lmysqlclient -llua

